You are here: Trading System Programming > Reference > Callback Functions > Functions > onOrderCancel

onOrderCancel

This callback function gets called whenever ActiveTick receives a response from a trading broker to previously canceled order.

 

Syntax

onOrderCancel(order, orderResults);

Parameters

order

Instance of Order object filled with details about the order.

 

orderResults

Instance of OrderResults object filled with result details about the order.

Remarks

This callback is useful to receive status indications wether the order cancel request has successfully been processed, or if it has failed.

Example

The following example demonstrates the use of onOrderCancel() callback function.

 

function start()

{

var account = getAccount();

 

//cancel all open limit orders

for(var i = 0; i < account.getOrders().lengh; i++)

{

var order = account.getOrders()[i];

 

if(order.getOrderType() == ORDERTYPE_LIMIT &&

order.getStatusType() == STATUSTYPE_OPEN)

{

account.placeOrderCancel(order);

}

}

}

 

function onOrderCancel(order, orderResults)

{

//process order results

 

if(getSymbol() != order.getSymbol())

return;

 

if(orderResults.getErrors().length == 0)

{

//order was canceled successfully

..

..

}

else

{

//order cancel failed

..

..

}

}

See Also

placeOrderCancel(), getAccount(), getSymbol(), Account Class, Order Class, OrderResults Class

 


Copyright © 2006-2009 ActiveTick LLC